package com.brayan.webapp.model.general.i18n;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.TableGenerator;
import javax.persistence.Transient;

import org.hibernate.validator.constraints.NotBlank;

import com.brayan.webapp.model.RootEntity;

/**
 * Entity implementation class for Entity: Translation
 * 
 */
@Entity
public class Translation extends RootEntity {
	
	private static final long serialVersionUID = -3863410193895734136L;

	public Translation(){		
	}

	@Id
	@TableGenerator(initialValue=1000, name = "TransTableGen")
	@GeneratedValue(strategy = GenerationType.IDENTITY , generator="TransTableGen")
	private Long id;

	/**
	 * a text may have multiple translations.
	 */
	@ManyToOne
	private Text textUnit;

	@ManyToOne
	private Locale locale;

	@Transient
	private boolean isTranslationFromParent = false;
	
	@NotBlank
	private String translation;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Text getTextUnit() {
		return textUnit;
	}

	public void setTextUnit(Text textUnit) {
		this.textUnit = textUnit;
	}

	public Locale getLocale() {
		return locale;
	}

	public void setLocale(Locale locale) {
		this.locale = locale;
	}

	public boolean isTranslationFromParent() {
		return isTranslationFromParent;
	}

	public void setTranslationFromParent(boolean isTranslationFromParent) {
		this.isTranslationFromParent = isTranslationFromParent;
	}

	public String getTranslation() {
		return translation;
	}

	public void setTranslation(String translation) {
		this.translation = translation;
	}

}
